import React, { Component } from 'react';
import {HomeNavStyled} from 'styled/Home/HomeNavStyled'
import {homeGetNav} from 'api/homeApi.js'
class HomeNav extends Component {
    constructor(props) {
        super(props);
        this.state={
            navData:[],//nav
        }
    }
    
    componentDidMount() {
        homeGetNav().then((ok)=>{
            // console.log(ok)
            this.setState({
                navData:ok
            })
        }).catch((err)=>{
            console.log(err)
        })
    }
    

    render() {
        return (
            <HomeNavStyled>
                <div className="wrapper">
                    <div className="item">
                        <span>首页</span>
                        {
                            this.state.navData.map((v,i)=>{
                                return (
                                    <span key={v.id}>{v.name}</span>
                                )
                            })
                        }
                    </div>
                </div>
                <i className="iconfont icon-caidan"></i>
            </HomeNavStyled>
        );
    }
}

export default HomeNav;